﻿Imports System.Data.SqlClient

Public Class clsEMPLEADOS
    Private cnConn As New SqlConnection
    Private Command As SqlCommand
    Public Sub CONECTA_BD_RELOJ()
        cnConn.ConnectionString = CitraConnection

        Command = New SqlCommand("sp_USUARIOS_CHECADOR", cnConn)
        Command.CommandType = CommandType.StoredProcedure
        Command.CommandTimeout = 0

        Command.Parameters.Add(New SqlParameter("@USERID", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@BADGENUMBER", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@NAME", SqlDbType.VarChar, 200))

        Try
            cnConn.Open()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End Try

    End Sub
    Public Sub CONECTA_BD()
        cnConn.ConnectionString = CitraConnection

        Command = New SqlCommand("sp_EMPLEADO_INSERTA", cnConn)
        Command.CommandType = CommandType.StoredProcedure
        Command.CommandTimeout = 0


        Command.Parameters.Add(New SqlParameter("@CLAVE", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@NOMBRE", SqlDbType.VarChar, 70))
        Command.Parameters.Add(New SqlParameter("@PATERNO", SqlDbType.VarChar, 70))
        Command.Parameters.Add(New SqlParameter("@MATERNO", SqlDbType.VarChar, 70))
        Command.Parameters.Add(New SqlParameter("@ESTATUS", SqlDbType.VarChar, 1))
        Command.Parameters.Add(New SqlParameter("@RFC", SqlDbType.VarChar, 13))
        Command.Parameters.Add(New SqlParameter("@DEPTO", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@PUESTO", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@NSS", SqlDbType.VarChar, 20))
        Command.Parameters.Add(New SqlParameter("@CLASIF", SqlDbType.VarChar, 1))
        Command.Parameters.Add(New SqlParameter("@FECHA_ALTA", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@FECHA_BAJA", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@SD", SqlDbType.Decimal))
        Command.Parameters.Add(New SqlParameter("@SDI", SqlDbType.Decimal))
        Command.Parameters.Add(New SqlParameter("@SDI_INFO", SqlDbType.Decimal))
        Command.Parameters.Add(New SqlParameter("@FECHA_SD", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@CALLE", SqlDbType.VarChar, 100))
        Command.Parameters.Add(New SqlParameter("@COLONIA", SqlDbType.VarChar, 100))
        Command.Parameters.Add(New SqlParameter("@CIUDAD", SqlDbType.VarChar, 100))
        Command.Parameters.Add(New SqlParameter("@ENT_FED", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@POSTAL", SqlDbType.VarChar, 2))
        Command.Parameters.Add(New SqlParameter("@CUENTA_PAGO", SqlDbType.VarChar, 20))
        Command.Parameters.Add(New SqlParameter("@LUGAR_NACIMIENTO", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@ESTADO_CIVIL", SqlDbType.VarChar, 1))
        Command.Parameters.Add(New SqlParameter("@UMF", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@TIPO_SANGRE", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@PENSION", SqlDbType.VarChar, 1))
        Command.Parameters.Add(New SqlParameter("@CAUSA_BAJA", SqlDbType.VarChar, 1))
        Command.Parameters.Add(New SqlParameter("@NOM_PADRE", SqlDbType.VarChar, 200))
        Command.Parameters.Add(New SqlParameter("@NOM_MADRE", SqlDbType.VarChar, 200))
        Command.Parameters.Add(New SqlParameter("@TELEFONO", SqlDbType.VarChar, 20))
        Command.Parameters.Add(New SqlParameter("@CELULAR", SqlDbType.VarChar, 20))
        Command.Parameters.Add(New SqlParameter("@TEL_RECADOS", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@SEXO", SqlDbType.VarChar, 1))
        Command.Parameters.Add(New SqlParameter("@FECHA_NACIMIENTO", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@CURP", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@MAIL", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@CLABE", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@REGIMEN", SqlDbType.VarChar, 50))
        Command.Parameters.Add(New SqlParameter("@PORCENTAJE_DESCUENTO", SqlDbType.Decimal))
        Command.Parameters.Add(New SqlParameter("@SUELDOXHORA", SqlDbType.Decimal))
        Try
            cnConn.Open()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End Try
    End Sub
    Public Sub GUARDA_USUARIO(ByVal USERID As Integer, ByVal BADGENUMBER As Integer, ByVal NAME As String)
        Command.Parameters("@USERID").Value = USERID
        Command.Parameters("@BADGENUMBER").Value = BADGENUMBER
        Command.Parameters("@NAME").Value = NAME

        Try
            Command.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")

        End Try
    End Sub
    Public Sub GUARDA_EMPLEADO(ByVal CLAVE As String, ByVal NOMBRE As String, ByVal PATERNO As String, ByVal MATERNO As String, ByVal ESTATUS As String, ByVal RFC As String, ByVal DEPTO As String, ByVal PUESTO As String, ByVal NSS As String, ByVal CLASIF As String, ByVal ALTA As Date, ByVal BAJA As Date, ByVal SD As Double, ByVal SDI As Double, ByVal SDI_INFO As Double, ByVal FECHA_SD As Date, ByVal CALLE As String, ByVal COLONIA As String, ByVal CIUDAD As String, ByVal ENTIDAD As Integer, ByVal POSTAL As String, ByVal CUENTA As String, ByVal LUGAR As String, ByVal CIVIL As String, ByVal UMF As Integer, ByVal SANGRE As Integer, ByVal PENSION As String, ByVal CAUSA As String, ByVal PADRE As String, ByVal MADRE As String, ByVal TELEFONO As String, ByVal SEXO As String, ByVal NACIMIENTO As Date, ByVal CURP As String, ByVal SUELDOXHORA As Double, ByVal CELULAR As String)
        'Command.Parameters.Add(New SqlParameter("@CLAVE", SqlDbType.VarChar, 30))
        Command.Parameters("@CLAVE").Value = CLAVE
        'Command.Parameters.Add(New SqlParameter("@NOMBRE", SqlDbType.VarChar, 70))
        Command.Parameters("@NOMBRE").Value = NOMBRE
        'Command.Parameters.Add(New SqlParameter("@PATERNO", SqlDbType.VarChar, 70))
        Command.Parameters("@PATERNO").Value = PATERNO
        'Command.Parameters.Add(New SqlParameter("@MATERNO", SqlDbType.VarChar, 70))
        Command.Parameters("@MATERNO").Value = MATERNO
        'Command.Parameters.Add(New SqlParameter("@ESTATUS", SqlDbType.VarChar, 1))
        Command.Parameters("@ESTATUS").Value = ESTATUS
        'Command.Parameters.Add(New SqlParameter("@RFC", SqlDbType.VarChar, 13))
        Command.Parameters("@RFC").Value = RFC
        'Command.Parameters.Add(New SqlParameter("@DEPTO", SqlDbType.VarChar, 30))
        Command.Parameters("@DEPTO").Value = DEPTO
        'Command.Parameters.Add(New SqlParameter("@PUESTO", SqlDbType.VarChar, 30))
        Command.Parameters("@PUESTO").Value = PUESTO
        'Command.Parameters.Add(New SqlParameter("@NSS", SqlDbType.VarChar, 20))
        Command.Parameters("@NSS").Value = NSS
        'Command.Parameters.Add(New SqlParameter("@CLASIF", SqlDbType.VarChar, 1))
        Command.Parameters("@CLASIF").Value = CLASIF
        'Command.Parameters.Add(New SqlParameter("@FECHA_ALTA", SqlDbType.DateTime))
        Command.Parameters("@FECHA_ALTA").Value = ALTA
        'Command.Parameters.Add(New SqlParameter("@FECHA_BAJA", SqlDbType.DateTime))
        Command.Parameters("@FECHA_BAJA").Value = BAJA
        'Command.Parameters.Add(New SqlParameter("@SD", SqlDbType.Decimal))
        Command.Parameters("@SD").Value = SD
        'Command.Parameters.Add(New SqlParameter("@SDI", SqlDbType.Decimal))
        Command.Parameters("@SDI").Value = SDI
        'Command.Parameters.Add(New SqlParameter("@SDI_INFO", SqlDbType.Decimal))
        Command.Parameters("@SDI_INFO").Value = SDI_INFO
        'Command.Parameters.Add(New SqlParameter("@FECHA_SD", SqlDbType.DateTime))
        Command.Parameters("@FECHA_SD").Value = FECHA_SD
        'Command.Parameters.Add(New SqlParameter("@CALLE", SqlDbType.VarChar, 100))
        Command.Parameters("@CALLE").Value = CALLE
        'Command.Parameters.Add(New SqlParameter("@COLONIA", SqlDbType.VarChar, 100))
        Command.Parameters("@COLONIA").Value = COLONIA
        'Command.Parameters.Add(New SqlParameter("@CIUDAD", SqlDbType.VarChar, 100))
        Command.Parameters("@CIUDAD").Value = CIUDAD
        'Command.Parameters.Add(New SqlParameter("@ENT_FED", SqlDbType.Int))
        Command.Parameters("@ENT_FED").Value = ENTIDAD
        'Command.Parameters.Add(New SqlParameter("@POSTAL", SqlDbType.VarChar, 2))
        Command.Parameters("@POSTAL").Value = POSTAL
        'Command.Parameters.Add(New SqlParameter("@CUENTA_PAGO", SqlDbType.VarChar, 20))
        Command.Parameters("@CUENTA_PAGO").Value = CUENTA
        'Command.Parameters.Add(New SqlParameter("@LUGAR_NACIMIENTO", SqlDbType.Int))
        Command.Parameters("@LUGAR_NACIMIENTO").Value = LUGAR
        'Command.Parameters.Add(New SqlParameter("@ESTADO_CIVIL", SqlDbType.VarChar, 1))
        Command.Parameters("@ESTADO_CIVIL").Value = CIVIL
        'Command.Parameters.Add(New SqlParameter("@UMF", SqlDbType.Int))
        Command.Parameters("@UMF").Value = UMF
        'Command.Parameters.Add(New SqlParameter("@TIPO_SANGRE", SqlDbType.Int))
        Command.Parameters("@TIPO_SANGRE").Value = SANGRE
        'Command.Parameters.Add(New SqlParameter("@PENSION", SqlDbType.VarChar, 1))
        Command.Parameters("@PENSION").Value = PENSION
        'Command.Parameters.Add(New SqlParameter("@CAUSA_BAJA", SqlDbType.VarChar, 1))
        Command.Parameters("@CAUSA_BAJA").Value = CAUSA
        'Command.Parameters.Add(New SqlParameter("@NOM_PADRE", SqlDbType.VarChar, 200))
        Command.Parameters("@NOM_PADRE").Value = PADRE
        'Command.Parameters.Add(New SqlParameter("@NOM_MADRE", SqlDbType.VarChar, 200))
        Command.Parameters("@NOM_MADRE").Value = MADRE
        'Command.Parameters.Add(New SqlParameter("@TELEFONO", SqlDbType.VarChar, 20))
        Command.Parameters("@TELEFONO").Value = TELEFONO
        'Command.Parameters.Add(New SqlParameter("@CELULAR", SqlDbType.VarChar, 20))
        Command.Parameters("@CELULAR").Value = CELULAR
        'Command.Parameters.Add(New SqlParameter("@TEL_RECADOS", SqlDbType.VarChar, 30))
        Command.Parameters("@TEL_RECADOS").Value = "N/D"
        'Command.Parameters.Add(New SqlParameter("@SEXO", SqlDbType.VarChar, 1))
        Command.Parameters("@SEXO").Value = SEXO
        'Command.Parameters.Add(New SqlParameter("@FECHA_NACIMIENTO", SqlDbType.DateTime))
        Command.Parameters("@FECHA_NACIMIENTO").Value = NACIMIENTO
        'Command.Parameters.Add(New SqlParameter("@CURP", SqlDbType.VarChar, 30))
        Command.Parameters("@CURP").Value = CURP
        'Command.Parameters.Add(New SqlParameter("@MAIL", SqlDbType.VarChar, 30))
        Command.Parameters("@MAIL").Value = "N/D"
        'Command.Parameters.Add(New SqlParameter("@CLABE", SqlDbType.VarChar, 30))
        Command.Parameters("@CLABE").Value = "N/D"
        'Command.Parameters.Add(New SqlParameter("@REGIMEN", SqlDbType.VarChar, 50))
        Command.Parameters("@REGIMEN").Value = "N/D"
        'Command.Parameters.Add(New SqlParameter("@PORCENTAJE_DESCUENTO", SqlDbType.Decimal))
        Command.Parameters("@PORCENTAJE_DESCUENTO").Value = 30
        'Command.Parameters.Add(New SqlParameter("@SUELDOXHORA", SqlDbType.Decimal))
        Command.Parameters("@SUELDOXHORA").Value = SUELDOXHORA

        Try
            Command.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")
            
        End Try


    End Sub

    Public Sub Cerrar_BD()
        If cnConn.State = ConnectionState.Open Then
            cnConn.Close()
        End If
    End Sub

End Class
